package baseFx.tests.database.monitor;

import baseFx.common.Assert;
import baseFx.database.execute.DbExecute;
import baseFx.database.monitor.After;
import baseFx.database.monitor.Before;
import baseFx.database.monitor.DbWatcher;
import baseFx.database.monitor.WatchOperation;
import baseFx.database.where.ExecuteWhere;

@DbWatcher
class Member2Watcher {
    private DbExecute execute;

    public Member2Watcher(DbExecute execute) {
        this.execute = execute;
    }

    @Before(value = WatchOperation.insert, table = Member2.class)
    public void beforeInsert(Member2 member2) {
        Assert.isEquals(member2.id, 333);
    }

    @After(value = WatchOperation.insert, table = Member2.class)
    public void afterInsert(Member2 member2) {
        Assert.isEquals(member2.id, 333);
    }

    @Before(value = WatchOperation.delete, table = Member2.class)
    public void beforeDelete(ExecuteWhere<Member2> where) {
        Assert.isEquals(where.eq().id, 222);
    }
}
